#ifndef FILEOBJECT_H
#define FILEOBJECT_H

#include <QObject>

#include <QObject>

class FileObject : public QObject {
  Q_OBJECT
  Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
public:
  explicit FileObject(QObject *parent = 0);

  Q_INVOKABLE QString read();
  Q_INVOKABLE QByteArray readByte();
  Q_INVOKABLE bool write(const QString &data);

  void setSource(const QString &source);
  QString source() { return m_source; }

  Q_INVOKABLE int size() const;

  Q_INVOKABLE QByteArray content() const;

signals:
  void sourceChanged(const QString &source);

private:
  QString m_source;
  QByteArray m_content;
  int m_size;
};

#endif // FILEOBJECT_H
